﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace SwiftMVVM.ValueConverters
{
    /// <summary>
    /// Converts back and forth between a boolean and the value passed in as the parameter
    /// </summary>
    public class EnumEqualsConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return (System.Enum.Parse(value.GetType(), (string)parameter)).Equals(value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return System.Enum.Parse(targetType, (string)parameter);
        }
    }

     
}
